package com.cqan.method.entity;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.cqan.entity.pk.LongEntity;

@Entity
//表名与类名不相同时重新定义表名.
@Table(name = "TBL_INTERFACE")
//默认的缓存策略.
@SuppressWarnings("serial")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class InterfaceMethod extends LongEntity{

	public enum MethodType{
		
		DELETE,GET,POST,PUT
	}
	
	private String description;
	
	private String methodName;
	
	private MethodType methodType;
	
	private List<Params> params;
	
	/**
	 * 后辍如：.json,html,xml等
	 */
	private String suffix;
	
	//请求地址
	private String url;
	
	private Date ctime;
	
	@Column(name="CTIME")
	public Date getCtime() {
		return ctime;
	}

	public void setCtime(Date ctime) {
		this.ctime = ctime;
	}

	@Column(name="DESCRIPTION")
	public String getDescription() {
		return description;
	}

	@Column(name="METHOD_NAME")
	public String getMethodName() {
		return methodName;
	}

	@Column(name="METHOD_TYPE")
	public MethodType getMethodType() {
		return methodType;
	}


	@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY,targetEntity=Params.class)
	@JoinColumn(name="IMID")
	public List<Params> getParams() {
		return params;
	}

	@Column(name="SUFFIX")
	public String getSuffix() {
		return suffix;
	}

	@Column(name="URL")
	public String getUrl() {
		return url;
	}



	public void setDescription(String description) {
		this.description = description;
	}



	public void setMethodName(String methodName) {
		this.methodName = methodName;
	}



	public void setMethodType(MethodType methodType) {
		this.methodType = methodType;
	}



	public void setParams(List<Params> params) {
		this.params = params;
	}



	public void setSuffix(String suffix) {
		this.suffix = suffix;
	}



	public void setUrl(String url) {
		this.url = url;
	}
	
}
